<template>
  <div>
    <BasicTable title="展示社团列表" titleHelpMessage="只是展示社团" :columns="columns" :dataSource="data"
      :pagination="{pageSize:10}">
    </BasicTable>
  </div>
</template>
<script lang="ts">
import { defineComponent, reactive } from 'vue';
import { useDeptStoreWithOut } from '/@/store/modules/dept';
import { BasicTable } from '/@/components/Table';
export default defineComponent({
  components: {
    BasicTable
  },
  setup() {
    let data: any[] = reactive([]);
    const getDetpList = async function () {
      const deptStore = useDeptStoreWithOut();
      console.log('%%%%%%%%%%%%%%', deptStore);
      try {
        // loading.value = true;
        const deptList: any = await deptStore.getDeptList({
          mode: 'none', //不要默认的错误提示
        });
        if (deptList) {
          for (let i = 0; i < deptList.length; i++) {
            data.push({
              id: deptList[i].id,
              name: deptList[i].name
            });
          }
        }
        return deptList
      } catch (error) {
        console.log(error);
      } finally {
      }
    };
    getDetpList();
    function getBasicColumns() {
      return [
        {
          title: '社团姓名',
          dataIndex: 'name',
          width: 150,
        },
      ];
    }

    return {
      getDetpList,
      data,
      columns:getBasicColumns(),
    };
  },
});
</script>
